
{extend name='public/window' /}

{block name="content"}
<style>
    .layui-upload-drag {
        position: relative;
        padding: 10px;
        border: 1px dashed #e2e2e2;
        background-color: #fff;
        text-align: center;
        cursor: pointer;
        color: #999;
        border-radius: 50%;
    }
    .layui-form-label{
        width: 110px;
    }
    .layui-input-block{
        width: 85%;
        margin-left: 146px;
    }
    .layui-input, .layui-textarea {
        display: block;
        width: 80%;
        padding-left: 10px;
    }
    /* .layui-form-select {
        position: absolute;
        right: 165px;
        top: 50%;
        } */
    .layui-form-select .layui-edge {
        position: absolute;
        right: 170px !important;
        top: 50%;
    }
    .layui-form-select dl {
        min-width: 80% !important;
    }
    .layui-form-label {
        width: 116px !important;
    }
</style>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body" style="padding: 15px;">
            <form class="layui-form" action="" lay-filter="form">
                <input type="hidden" name="__token__" id="token" value="{:token()}"/>
<!--                <div class="layui-form-item">-->
<!--                    <label class="layui-form-label">商户 </label>-->
<!--                    <div class="layui-input-block" >-->
<!--                        <select name="merchant_id"  lay-verify="required"  lay-search="">-->
<!--                            <option value="">请选择</option>-->
<!--                            {volist name="merchant_list" id="t"}-->
<!--                            {if empty($t.name)||$t.name=='-'}-->
<!--                            <option value="{$t.id}" >{$t.company} - {$t.code}-{$t.biz_state}-{$t.positions_code}</option>-->
<!--                            {else/}-->
<!--                            <option value="{$t.id}" >{$t.name} - {$t.code}-{$t.biz_state}-{$t.positions_code}</option>-->
<!--                            {/if}-->
<!--                            {/volist}-->

<!--                        </select>-->
<!--                    </div>-->
<!--                </div>-->
                <div class="layui-form-item">
                    <label class="layui-form-label">类型 </label>
                    <div class="layui-input-block" >
                        <select name="type"  lay-filter="type" id="type"  lay-verify="required" >
                            <option value="">请选择</option>
                            <option value="1" >电费</option>
                            <option value="2" >充值记录</option>
                            <option value="3" >水费</option>
                            <option value="5" >月结凭证</option>
                            <option value="6" >余额缴费</option>
                            <option value="7" >转账缴费</option>
                            <option value="8" >线上缴费</option>
                        </select>
                    </div>
                </div>
                <div id="cost_type_id" class="layui-form-item" style="display: none">
                    <label class="layui-form-label">所属费用项 </label>
                    <div class="layui-input-block" >
                        <select name="cost_type_id"  lay-filter="cost_type_id"  >
                            <option value="">请选择</option>
                            <option value="11" >GAG维护费</option>
                            <option value="4" >花车管理费</option>
                            <option value="8" >比率推广费</option>
                            <option value="10" >仓库物业管理费</option>
                            <option value="9" >仓库租金</option>
                            <option value="13" >场地管理费</option>
                            <option value="2" >正柜浮动租金</option>
                            <option value="1" >正柜固定租金</option>
                            <option value="12" >广告位出租</option>
                            <option value="7" >固定推广费</option>
                            <option value="5" >商铺物业管理费</option>
                            <option value="6" >写字楼物业管理费</option>
                            <option value="3" >写字楼固定租金</option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline" id="day">
                    <label class="layui-form-label">选择时间：</label>
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" name="start_time" id="start_time" placeholder="">
                    </div>
                </div>
                <div class="layui-inline" id="month" style="display: none">
                    <label class="layui-form-label">选择月份：</label>
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" name="start_month" id="start_month" placeholder="">
                    </div>
                </div>
                <div class="layui-form-item layui-layout-admin " style="width: 100%">
                    <div class="layui-input-block">
                        <div class="layui-footer" style="left: 0px;text-align: center;">
                            <button    class="layui-btn " lay-submit="" lay-filter="add">{:__('Submit')}</button>
                            <button type="reset" class="layui-btn layui-btn-primary">{:__('Reset')}</button>
                        </div>
                    </div>
                </div>
                <div class="layui-inline" id="qujian" style="display: none">
                    <label class="layui-form-label">选择时间区间：</label>
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" name="star_time" id="star_time" placeholder="开始时间">
                        <div style="margin: 10px"></div>
                        <input type="text" class="layui-input" name="end_time" id="end_time" placeholder="结束时间">
                    </div>
                </div>
                <div  class="layui-form-item layui-layout-admin " style="font-size:14px;color: red">
                    <div class="layui-input-block">
                    注意:凭证会根据您选择的日期进行推送(即:选择23年8月即为推送23年8月的水费或电费凭证.选择2023-09-10即为推送2023-09-10的充值凭证)
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>


<script>
    layui.use(['element', 'form', 'jquery','lucky','upload','laydate','xmSelect'], function () {
        var element = layui.element;
        var table = layui.table;
        var form = layui.form;
        var laydate = layui.laydate;
        var $ = layui.jquery;
        var lucky=layui.lucky;
        laydate.render({
            elem: '#star_time'
            ,type: 'date',
            trigger: 'click'
        });
        laydate.render({
            elem: '#start_time'
            ,type: 'date',
            trigger: 'click'
        });
        laydate.render({
            elem: '#end_time'
            ,type: 'date',
            trigger: 'click'
        });
        laydate.render({
            elem: '#start_month'
            ,type: 'month',
            trigger: 'click'
        });
        form.on('select(type)', function(data){
            var  pid = data.value;
            if(pid==1||pid==3){
                $("#month").css('display','block'); //显示
                $("#day").css('display','none'); //显示
                $('#start_time').val('')
                $('#cost_type_id').css('display','none')//选择费用项隐藏
                $("#qujian").css('display','none'); //显示
            }else if(pid==5){
                $("#month").css('display','block'); //显示
                $("#day").css('display','none'); //选择天隐藏
                $('#start_month').val('')
                $('#cost_type_id').css('display','block')//选择费用项显示
                $("#qujian").css('display','none'); //显示
            }else if(pid==6||pid==7||pid==8){
                $("#qujian").css('display','block'); //显示
                $("#day").css('display','none'); //显示
                $("#month").css('display','none'); //显示
                $('#cost_type_id').css('display','none') //选择费用项隐藏
            }else {
                $("#day").css('display','block'); //显示
                $("#month").css('display','none'); //显示
                $('#start_month').val('')
                $('#cost_type_id').css('display','none') //选择费用项隐藏
                $("#qujian").css('display','none'); //显示
            }
        });
        form.on('submit(add)', function (data) {
            console.log(data)
            lucky.FormSubmit("{:url('add')}",data.field,true);
            return false;
        });
    })
</script>

{/block}

